package com.yang.auth.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yang.auth.model.entity.Role;
import com.yang.auth.model.mapper.RoleMapper;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class RoleDao extends ServiceImpl<RoleMapper, Role> {

    public List<Role> selectAllEnableRoleCoreField() {
        return baseMapper.selectList(
                    new LambdaQueryWrapper<Role>()
                        .select(Role::getId, Role::getRoleName, Role::getRoleKey)   //  查询核心字段
                        .eq(Role::getIsDeleted, false)                          //  角色未被删除
                        .eq(Role::getStatus, 0)                                 //  状态正常
        );
    }
}
